package com.point.ootb.domain.enity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import com.point.ootb.domain.vo.LoginUserInfoVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "sys_user" , autoResultMap = true)
@SuperBuilder
@Table(name = "sys_user", comment = "用户表")
public class SysUser extends BaseEntity{

    @Column(type = MySqlTypeConstant.VARCHAR, comment = "手机号")
    private String phone;

    @Column(type = MySqlTypeConstant.VARCHAR, comment = "用户昵称")
    private String nickName;

    @Column(type = MySqlTypeConstant.VARCHAR, comment = "密码")
    private String password;
    
    @Column(type = MySqlTypeConstant.VARCHAR, comment = "头像")
    private String avatar;

    public LoginUserInfoVO getLoginUserInfo(SysUser sysUser){
        LoginUserInfoVO loginUserInfoVO = new LoginUserInfoVO();
        loginUserInfoVO.setUserId(sysUser.getId());
        loginUserInfoVO.setPhone(sysUser.getPhone());
        loginUserInfoVO.setNickName(sysUser.getNickName());
        return loginUserInfoVO;
    }
}
